import {
  Toast
} from "vant";
export default {
  components: {},
  props: {},
  data() {
    return {
      list: [{
          title: "经销商"
        },
        {
          title: "区县代"
        },
        {
          title: "市代"
        },
        {
          title: "省代"
        }
      ],
      jin_num: [], //今日数据
      fenhong: [], //昨日分红
      zuo_num: [], //昨日个数
      shenfen: "", //当前身份
      yeji: 0, //总业绩
      x_yeji: 0, //小区业绩
      d_yeji: 0, //大区业绩
      //   items: [null, null, null, null],
    };
  },
  activated() {
    // if (!localStorage.getItem("uid")) {
    //   this.$router.push(this.fun.getUrl("member"));
    //   return
    // }
    // this.getData();
    this.getUid();
  },

  methods: {
    getUid() {
      $http.get("Uidhuoqu.index", {}, "加载中").then(
        response => {
          console.log(response, 'Uidhuoqu.index');
          let uid = response.data;
          // localStorage.setItem("newUid",uid);
          if (!uid) {
            this.$router.push(this.fun.getUrl("member"));
            return
          }
          this.getData(uid);
        }
      );

    },
    goback() {
      this.$router.go(-1);
    },
    toDetail(timeType, index) {
      let type = index + 1;
      this.$router.push(this.fun.getUrl("performanceGu_detail", {
        timeType: timeType,
        type: type
      }));
    },
    getData(uid) {
      // 谷昕宇--获取业绩列表
      var that = this;
      $http
        .get(
          "Guxinyu.gx_list", {
            // uid: localStorage.getItem("uid") ? localStorage.getItem("uid") : localStorage.getItem("newUid")
            // uid: 64045
            uid: uid
          },
          "..."
        )
        .then(response => {
          that.yeji = response.data.yeji.yeji;
          that.x_yeji = response.data.yeji.x_yeji; //小区业绩
          // that.d_yeji = response.data.yeji.yeji - response.data.yeji.x_yeji;//小区业绩
          that.shenfen = response.data.shenfen ? response.data.shenfen.level_name : "暂无";
          that.jin_num = response.data.jin_num;
          that.fenhong = response.data.fenhong;
          that.zuo_num = response.data.zuo_num;
        });
    }
  }
};